Make character encoding tables optional at build time.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 5 May 2006 20:37:41 +0000 (20:37 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Fri, 5 May 2006 20:37:41 +0000 (20:37 +0000)
gpsbabel/cet_util.c
gpsbabel/config.h.in
gpsbabel/configure
gpsbabel/configure.in

index d5ee5c8f3bdb122a436d61716bbf2def3c559f20..800051cac1529c7248954ac9c7cb14a1d4b500d4 100644 (file)
@@ -205,12 +205,11 @@ cet_valid_char(const char *src, const cet_cs_vec_t *vec)
 }
 
 /* %%% include character set headers %%% */
-
-#include "cet/ansi_x3_4_1968.h"
-#include "cet/atarist.h"
-#include "cet/baltic.h"
-#include "cet/bs_4730.h"
-#include "cet/bs_viewdata.h"
+#if defined (CET_WANTED)
+#include "cet/iso_8859_2.h"
+#include "cet/cp1250.h"
+#include "cet/latin_greek_1.h"
+#include "cet/macintosh.h"
 #include "cet/cp1250.h"
 #include "cet/cp1251.h"
 #include "cet/cp1252.h"
@@ -219,6 +218,44 @@ cet_valid_char(const char *src, const cet_cs_vec_t *vec)
 #include "cet/cp1255.h"
 #include "cet/cp1256.h"
 #include "cet/cp1257.h"
+#include "cet/ibm437.h"
+#include "cet/ibm850.h"
+#include "cet/ibm851.h"
+#include "cet/ibm852.h"
+#include "cet/ibm855.h"
+#include "cet/ibm857.h"
+#include "cet/ibm860.h"
+#include "cet/ibm861.h"
+#include "cet/ibm862.h"
+#include "cet/ibm863.h"
+#include "cet/ibm864.h"
+#include "cet/ibm865.h"
+#include "cet/ibm868.h"
+#include "cet/ibm869.h"
+#include "cet/iso_8859_1.h"
+#include "cet/iso_8859_10.h"
+#include "cet/iso_8859_13.h"
+#include "cet/iso_8859_14.h"
+#include "cet/iso_8859_15.h"
+#include "cet/iso_8859_2.h"
+#include "cet/iso_8859_3.h"
+#include "cet/iso_8859_4.h"
+#include "cet/iso_8859_5.h"
+#include "cet/iso_8859_6.h"
+#include "cet/iso_8859_7.h"
+#include "cet/iso_8859_8.h"
+#include "cet/iso_8859_9.h"
+#include "cet/koi8_r.h"
+#include "cet/koi8_ru.h"
+#include "cet/koi_8.h"
+#endif
+
+#if CET_WANTED
+#include "cet/ansi_x3_4_1968.h"
+#include "cet/atarist.h"
+#include "cet/baltic.h"
+#include "cet/bs_4730.h"
+#include "cet/bs_viewdata.h"
 #include "cet/csa_z243_4_1985_1.h"
 #include "cet/csa_z243_4_1985_2.h"
 #include "cet/csa_z243_4_1985_gr.h"
@@ -245,21 +282,7 @@ cet_valid_char(const char *src, const cet_cs_vec_t *vec)
 #include "cet/ibm284.h"
 #include "cet/ibm285.h"
 #include "cet/ibm297.h"
-#include "cet/ibm437.h"
 #include "cet/ibm500.h"
-#include "cet/ibm850.h"
-#include "cet/ibm851.h"
-#include "cet/ibm852.h"
-#include "cet/ibm855.h"
-#include "cet/ibm857.h"
-#include "cet/ibm860.h"
-#include "cet/ibm861.h"
-#include "cet/ibm862.h"
-#include "cet/ibm863.h"
-#include "cet/ibm864.h"
-#include "cet/ibm865.h"
-#include "cet/ibm868.h"
-#include "cet/ibm869.h"
 #include "cet/ibm871.h"
 #include "cet/ibm891.h"
 #include "cet/ibm903.h"
@@ -269,19 +292,6 @@ cet_valid_char(const char *src, const cet_cs_vec_t *vec)
 #include "cet/iso_5427.h"
 #include "cet/iso_646_irv.h"
 #include "cet/iso_6937_2_25.h"
-#include "cet/iso_8859_1.h"
-#include "cet/iso_8859_10.h"
-#include "cet/iso_8859_13.h"
-#include "cet/iso_8859_14.h"
-#include "cet/iso_8859_15.h"
-#include "cet/iso_8859_2.h"
-#include "cet/iso_8859_3.h"
-#include "cet/iso_8859_4.h"
-#include "cet/iso_8859_5.h"
-#include "cet/iso_8859_6.h"
-#include "cet/iso_8859_7.h"
-#include "cet/iso_8859_8.h"
-#include "cet/iso_8859_9.h"
 #include "cet/iso_8859_supp.h"
 #include "cet/it.h"
 #include "cet/jis_c6220_1969_ro.h"
@@ -290,11 +300,8 @@ cet_valid_char(const char *src, const cet_cs_vec_t *vec)
 #include "cet/jus_i_b1_003_mac.h"
 #include "cet/jus_i_b1_003_serb.h"
 #include "cet/keybcs2.h"
-#include "cet/koi8_r.h"
-#include "cet/koi8_ru.h"
 #include "cet/koi8_u.h"
 #include "cet/koi_7.h"
-#include "cet/koi_8.h"
 #include "cet/koi_8_cs2.h"
 #include "cet/ksc5636.h"
 #include "cet/latin_greek_1.h"
@@ -318,6 +325,7 @@ cet_valid_char(const char *src, const cet_cs_vec_t *vec)
 #include "cet/tcvn.h"
 #include "cet/viscii.h"
 #include "cet/vps.h"
+#endif
 
 #ifdef DEBUG_MEM
 
index f0ff994a3583c72bc0d8388eff2552e9a2801f83..e20a847d67b6ff7db8810ee96703f40613d9244d 100644 (file)
@@ -1,5 +1,8 @@
 /* config.h.in.  Generated from configure.in by autoheader.  */
 
+/* "0 for most-used character sets" */
+#undef CET_WANTED
+
 /* Defined if you have libexpat */
 #undef HAVE_LIBEXPAT
 
index b154f56de7b061ede36a023589907d73aee64d9e..bbcf16106f7d8ff8e4c56c79c951052914aa2cfd 100755 (executable)
@@ -804,6 +804,11 @@ if test -n "$ac_init_help"; then
    esac
   cat <<\_ACEOF
 
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+--with-cet=(default,all,minimal)
+
 Some influential environment variables:
   CC          C compiler command
   CFLAGS      C compiler flags
@@ -2492,6 +2497,31 @@ _ACEOF
 fi
 
 
+#AC_ARG_ENABLE(allcet, "Enable all character sets", AC_DEFINE(WANT_ALLCET, 1, [Define if you want support for all known character sets]))
+#AC_ARG_ENABLE(cet, "Enable character sets=(default,all,minimal)")
+
+# Check whether --with-cet or --without-cet was given.
+if test "${with_cet+set}" = set; then
+  withval="$with_cet"
+  cet="$withval"
+else
+  cet="default"
+fi;
+
+if test "$cet" = "all"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define CET_WANTED 1
+_ACEOF
+
+fi
+if test "$cet" = "default"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define CET_WANTED 0
+_ACEOF
+
+fi
 
 case "$target" in
     *-*-cygwin* | *-*-mingw32*)
@@ -2637,11 +2667,19 @@ echo "$as_me: error: libusb >= 0.1.8 is needed" >&2;}
 
 fi
 
+               # Override libusb for Darwin to reduce external
+               # runtime requirement.
+               case "$target" in
+               *-*-darwin*)
+                 if test "x$ac_cv_lib_usb_usb_interrupt_read" = "xyes" ; then
+                       USB_LIBS="`libusb-config --prefix`/lib/libusb.a -framework  IOKit -framework CoreFoundation"
+                 fi
+               esac
                OSJEEPS=jeeps/gpslibusb.o
                CFLAGS="$OCFLAGS"
        #       LIBS="$LIBS `libusb-config --libs`"
        fi
-    ;;
+       ;;
 esac
 
 
@@ -2661,14 +2699,22 @@ echo "${ECHO_T}check not done" >&6
 else
 
 # Special case fink test.
-       if test -f /sw/include/expat.h; then
-               CFLAGS="$CFLAGS -I/sw/include"
-       fi
-       if test -f /sw/include/expat.h; then
-               LDFLAGS="$LDFLAGS -L/sw/lib"
-       fi
+       case "$target" in
+       *-*-darwin*)
+               if test -f /sw/include/expat.h -a -f /sw/include/expat.h; then
+                       CFLAGS="$CFLAGS -I/sw/include"
+                       LDFLAGS="$LDFLAGS -L/sw/lib"
+                       # Static link against expat archive, not dyn lib.
 
-       echo "$as_me:$LINENO: checking for XML_ParserCreate in -lexpat" >&5
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBEXPAT 1
+_ACEOF
+
+                       EXPAT_LIB=/sw/lib/libexpat.a
+               fi
+               ;;
+       *)
+               echo "$as_me:$LINENO: checking for XML_ParserCreate in -lexpat" >&5
 echo $ECHO_N "checking for XML_ParserCreate in -lexpat... $ECHO_C" >&6
 if test "${ac_cv_lib_expat_XML_ParserCreate+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2738,9 +2784,12 @@ cat >>confdefs.h <<\_ACEOF
 #define HAVE_LIBEXPAT 1
 _ACEOF
 
-               EXPAT_LIB="$LDFLAGS -lexpat"
+                       EXPAT_LIB="$LDFLAGS -lexpat"
 fi
 
+
+               ;;
+       esac
 fi
 
 
index db8274bfb47dd9d2077ceebe11e6f59d91e3d333..6047dba6399f095ab41e7e07bf0de698d48b0a6e 100644 (file)
@@ -20,6 +20,15 @@ AC_SUBST(AC_EXEEXT)
 # Checks for libraries.
 AC_CHECK_LIB([m], [cos])
 
+AC_ARG_WITH(cet,[--with-cet=(default,all,minimal)],
+             cet="$withval", cet="default")
+
+if test "$cet" = "all"; then
+   AC_DEFINE(CET_WANTED, 1, "1 for all character sets")
+fi
+if test "$cet" = "default"; then
+   AC_DEFINE(CET_WANTED, 0, "0 for most-used character sets")
+fi
  
 case "$target" in
     *-*-cygwin* | *-*-mingw32*)